package com.micro.modual.extension;

import com.micro.common.MicroConstant;
import com.micro.common.biz.GeneratorCodeUtil;
import com.micro.common.util.SnowFlakeUtil;
import com.micro.modual.entity.Coupon;
import com.micro.modual.model.bo.coupon.CouponBO;

/**
 * <h1>优惠券表 延展类</h1>
 * @author LevelCoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020-08-04 00:23:27
 */
public class CouponExtension {

    /**
     * <h2>转换: 优惠券表 新增</h2>
     * @param couponBO {@link CouponBO} 优惠券表 新增/修改 请求对象
     * @return {@link Coupon} 优惠券表
     */
    public static Coupon converAddCoupon(CouponBO couponBO) {
        Coupon coupon = new Coupon();
        coupon.setId(SnowFlakeUtil.getId());
                                                            coupon.setTemplateCode(couponBO.getTemplateCode());
                                                    coupon.setUserCode(couponBO.getUserCode());
                                                    coupon.setCouponCode(couponBO.getCouponCode());
                                                    coupon.setAssignTime(couponBO.getAssignTime());
                                                    coupon.setCouponStatus(couponBO.getCouponStatus());
                                                    coupon.setUserNickName(couponBO.getUserNickName());
                                                    coupon.setReceiveType(couponBO.getReceiveType());
                            return coupon;
    }

    /**
     * <h2>转换: 优惠券表 修改</h2>
     * @param couponBO {@link CouponBO} 优惠券表 新增/修改 请求对象
     * @return {@link Coupon} 优惠券表
     */
    public static Coupon converEditCoupon(CouponBO couponBO) {
        Coupon coupon = new Coupon();
        coupon.setId(couponBO.getId());
                                                        coupon.setTemplateCode(couponBO.getTemplateCode());
                                                coupon.setUserCode(couponBO.getUserCode());
                                                coupon.setCouponCode(couponBO.getCouponCode());
                                                coupon.setAssignTime(couponBO.getAssignTime());
                                                coupon.setCouponStatus(couponBO.getCouponStatus());
                                                coupon.setUserNickName(couponBO.getUserNickName());
                                                coupon.setReceiveType(couponBO.getReceiveType());
                            return coupon;
    }
}
